Einhugur Xml Plugin for Xojo

Node.SelectNodes Method

The SelectNodes function compiles the XPath expression and then executes it with the node as a context node, and returns the resulting node set. The function can optionally take in XPath variables.

SelectNodes(
   query as String,
   variables as EinhugurXml.XPathVariableSet) as EinhugurXml.XPathNodeSet

Parameters

query
The expression query.
variables
This is optional parameter with default value nil.

This parameter takes in XPathVariableSet to use in the query.

Returns

EinhugurXml.XPathNodeSet
XPathNodeSet which can either carry Node instances or Attribute instances.

Remarks

This function can throw EinhugurXPathException.

Example:

var queryResut as EinhugurXml.XPathNodeSet = doc.SelectNodes("/Profile/Tools/Tool[@AllowRemote='true' and @DeriveCaptionFrom='lastparam']")

for each child as EinhugurXml.XPathNode in queryResut.XPathNodes
    MessageBox child.Node.Name + " - " + child.Node.Attribute("Filename").AsString
next



While compiling expressions is fast, the compilation time can introduce a significant overhead if the same expression is used many times on small subtrees. If you’re doing many similar queries, consider compiling them into query objects. Once you get a compiled query object, you can pass it to select functions instead of an expression string.

See Also

Node Class